//
//  SbMainVC+UI.swift
//  Auscultation
//
//  Created by 来 on 2020/12/23.
//

import Foundation

extension SbMainVC {
    
    func initUI() {
        let top_view = UIImageView()
        top_view.image = UIImage(named: "table2")

        top_view.isUserInteractionEnabled = true
        view.addSubview(top_view)
        top_view.snp.makeConstraints { (make) in
            make.top.left.right.equalToSuperview()
            make.height.equalTo(100)
        }
        
        let label1 = UILabel.init()
        label1.text = "采集"
        label1.textColor = UIColor.white
        label1.font = UIFont.boldSystemFont(ofSize: 30)
        top_view.addSubview(label1)
        label1.snp.makeConstraints { (make) in
            make.left.equalToSuperview().offset(20)
            make.centerY.equalToSuperview().multipliedBy(1.0).offset((UIDevice.lgf_NavBarH() - 44) / 2)
        }
        
        let scrollView = UIScrollView.lgf_Table("FFFFFF")
        if #available(iOS 11.0, *) {
            scrollView.contentInsetAdjustmentBehavior = .never
        } else {
            self.automaticallyAdjustsScrollViewInsets = false
        }
        view.addSubview(scrollView)
        scrollView.snp.makeConstraints { (make) in
            make.top.equalTo(top_view.snp.bottom)
            make.left.right.bottom.equalToSuperview()
        }
        
        let sb = UIImageView()
        sb.image = UIImage(named: "设备")
        sb.isUserInteractionEnabled = true
        sb.lgf_AddTap(target: self, action: #selector(s_sb(_:)))
        scrollView.addSubview(sb)
        sb.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(20)
            make.left.equalToSuperview().offset(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(100)
        }
        
        let sb_l1 = UILabel.init()
        sb_l1.text = "设备"
        sb_l1.font = UIFont.boldSystemFont(ofSize: 18)
        sb_l1.textColor = UIColor.white
        sb.addSubview(sb_l1)
        sb_l1.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(24)
            make.left.equalToSuperview().offset(20)
        }
        
        let sb_l2 = UILabel.init()
        sb_l2.text = "Equipment"
        sb_l2.font = UIFont.systemFont(ofSize: 14)
        sb_l2.textColor = UIColor.white
        sb.addSubview(sb_l2)
        sb_l2.snp.makeConstraints { (make) in
            make.top.equalTo(sb_l1.snp.bottom).offset(5)
            make.left.equalToSuperview().offset(20)
            make.height.equalTo(20)
        }
        
        let xyyb = UIImageView()
        xyyb.image = UIImage(named: "样本")

        xyyb.isUserInteractionEnabled = true
        xyyb.lgf_AddTap(target: self, action: #selector(s_xyyb(_:)))
        scrollView.addSubview(xyyb)
        xyyb.snp.makeConstraints { (make) in
            make.top.equalTo(sb.snp.bottom).offset(9)
            make.left.equalToSuperview().offset(15)
            make.right.equalToSuperview().offset(-15)
            make.height.equalTo(100)
            make.width.equalTo(UIDevice.lgf_ScreenW - 30)

        }
        
        let xyyb_l1 = UILabel.init()
        xyyb_l1.text = "已采集心音样本"
        xyyb_l1.font = UIFont.boldSystemFont(ofSize: 18)
        xyyb_l1.textColor = UIColor.white
        xyyb.addSubview(xyyb_l1)
        xyyb_l1.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(24)
            make.left.equalToSuperview().offset(20)
            make.height.equalTo(20)

        }
        
        let xyyb_l2 = UILabel.init()
        xyyb_l2.text = "Heart sound samples collected"
        xyyb_l2.numberOfLines = 2
        xyyb_l2.font = UIFont.systemFont(ofSize: 14)
        xyyb_l2.textColor = UIColor.white
        xyyb.addSubview(xyyb_l2)
        xyyb_l2.snp.makeConstraints { (make) in
            make.top.equalTo(xyyb_l1.snp.bottom).offset(5)
            make.left.equalToSuperview().offset(20)
            make.width.equalToSuperview().multipliedBy(0.7)
        }
        
    }
    
}
